var page;
let getData = that => {
  let params = {
    page: page
  }
  wx.request({
    url: 'https://qili.docdic.com/api/order',
    method: 'get',
    data: params,
    success: function (res) {
      let data = res.data.data
      that.setData(data)
      app.globalData.factory = data
    }
  })
}
//获取应用实例
var app = getApp()
Page({
  data: {
    swiper: {
      userInfo: {},
      indicatorDots: true,//是否显示面板指示点
      indicatorColor: 'rgba(249,245,236,0.6)',
      indicatorActiveColor: '#FFCC66',
      autoplay: true,//是否自动切换
      interval: 5000,//自动切换时间间隔
      duration: 500,//滑动动画时长
      circular: true//是否自动切换
    },
    isLoading: false,//正在加载中
    noMore: false//是否还有更多数据
  },
  onLoad: function (e) {
    page = 1
    getData(this)
  },
  onReachBottom: function () {
    console.log(this.data.has_more)
    if (!this.data.has_more) {
      var that = this;
      this.setData({
        isLoading: true
      })
      var timer = setTimeout(function () {
        console.log(888);
        that.setData({
          isLoading: false,
          noMore:true
        })
        clearTimeout(timer);
      }, 1000)
    }else{
      page += 1
      getData(this)
    }
  }

})
